package com.coocaa.ops.api.v1.params;

import com.coocaa.ops.api.common.model.ResponseData;
import com.coocaa.ops.api.common.util.ResponseUtil;
import com.coocaa.ops.api.v1.params.model.IGetOpsParamModel;
import com.coocaa.ops.api.v1.params.model.OpsParamModel;
import com.coocaa.ops.api.v1.params.service.ParamsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * @author zen
 * @date 2020-11-02 16:50
 * @description
 */
@Slf4j
@RestController
@RequestMapping("/tvos")
public class ParamsController {
    @Autowired
    private ParamsService paramsService;

    @RequestMapping(value = "/getOpsParam", method = RequestMethod.GET)
    @ResponseBody
    public ResponseData<List> getOpsParam(HttpServletRequest request, IGetOpsParamModel requestParams) {
        String type = requestParams.getType();
        List<OpsParamModel> data = paramsService.getOpsParam(request, type);
        return  ResponseUtil.renderSuccess("success", data);
    }
}
